package com.paperobot.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.paperobot.dao.BaseDao;
import com.paperobot.dao.MagazineDao;
import com.paperobot.model.Magazine;

@Repository("magazineDao")
public class MagazineDaoImpl extends BaseDao implements MagazineDao{

	public Long addMagazine(Magazine magazine) throws Exception {
		Object obj=	saveObject("addMagazine", magazine);
		if(null!=obj){
			return (Long)obj;
		}
		return -1L;
	}

	public int deleteMagazine(Long magazineId) throws Exception {
		return deleteObject("deleteMagazine", magazineId);
	}

	public Magazine getMagazine(Long magazineId) throws Exception {
		return (Magazine) getObject("getMagazine", magazineId);
	}

	@SuppressWarnings("unchecked")
	public List<Magazine> getMagazineList(Map<String, Object> map) throws Exception {
		return (List<Magazine>) getObjects("getMagazineList", map);
	}

	public int updateMagazine(Magazine magazine) throws Exception {
		return updateObject("updateMagazine", magazine);
	}

}
